package cn.btks.backstagemanage.bu.controller;

import cn.btks.backstagemanage.bu.pojo.*;
import cn.btks.backstagemanage.bu.service.YqsthjService;
import cn.btks.commonserver.result.ResultState;
import cn.btks.commonserver.result.StateInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@Slf4j
@RestController
@RequestMapping("api/v1.0/bu")
@Api(tags = "业务查询模块")
@Validated
public class BuController {

    @Autowired
    YqsthjService yqsthjService;

    @GetMapping("/cyzcml/list")
    @ApiOperation("产业政策目录表列表查询")
    public ResultState cyzcmlList(@RequestParam(name = "keyWord") String keyWord) {
        List<BuCyzcml> list = yqsthjService.cyzcmlList(keyWord);
        return list != null ? new ResultState(StateInfo.FIND_OK.getCode(),
                StateInfo.FIND_OK.getMsg(), list) : new ResultState(StateInfo.FIND_NULL.getCode(),
                StateInfo.FIND_NULL.getMsg());
    }

    @GetMapping("/jsgfml/list")
    @ApiOperation("兵团重点行业涉及的主要技术规范文件目录列表查询")
    public ResultState jsgfmlList(@RequestParam(name = "keyWord") String keyWord) {
        List<BuJsgfml> list = yqsthjService.jsgfmlList(keyWord);
        return list != null ? new ResultState(StateInfo.FIND_OK.getCode(),
                StateInfo.FIND_OK.getMsg(), list) : new ResultState(StateInfo.FIND_NULL.getCode(),
                StateInfo.FIND_NULL.getMsg());
    }

    @GetMapping("/scgyjs/list")
    @ApiOperation("兵团重点行业推荐生产工艺技术列表查询")
    public ResultState scgyjsList(@RequestParam(name = "keyWord") String keyWord) {
        List<BuScgyjs> list = yqsthjService.JsgfmlList(keyWord);
        return list != null ? new ResultState(StateInfo.FIND_OK.getCode(),
                StateInfo.FIND_OK.getMsg(), list) : new ResultState(StateInfo.FIND_NULL.getCode(),
                StateInfo.FIND_NULL.getMsg());
    }

    @GetMapping("/wrfzcs/list")
    @ApiOperation("兵团重点行业推荐污染防治措施列表查询")
    public ResultState wrfzcsList(@RequestParam(name = "keyWord") String keyWord) {
        List<BuWrfzcs> list = yqsthjService.wrfzcsList(keyWord);
        return list != null ? new ResultState(StateInfo.FIND_OK.getCode(),
                StateInfo.FIND_OK.getMsg(), list) : new ResultState(StateInfo.FIND_NULL.getCode(),
                StateInfo.FIND_NULL.getMsg());
    }

    @GetMapping("/yqsthj/list")
    @ApiOperation("园区生态环境质量基础数据库列表查询")
    public ResultState yqsthjList(@RequestParam(name = "keyWord") String keyWord) {
        List<BuYqsthj> list = yqsthjService.yqsthjList(keyWord);
        return list != null ? new ResultState(StateInfo.FIND_OK.getCode(),
                StateInfo.FIND_OK.getMsg(), list) : new ResultState(StateInfo.FIND_NULL.getCode(),
                StateInfo.FIND_NULL.getMsg());
    }

    @GetMapping("/zryqml/list")
    @ApiOperation("兵团重点行业涉及的主要准入要求文件目录")
    public ResultState zryqmlList(@RequestParam(name = "keyWord") String keyWord) {
        List<BuZryqml> list = yqsthjService.zryqmlList(keyWord);
        return list != null ? new ResultState(StateInfo.FIND_OK.getCode(),
                StateInfo.FIND_OK.getMsg(), list) : new ResultState(StateInfo.FIND_NULL.getCode(),
                StateInfo.FIND_NULL.getMsg());
    }

    @GetMapping("/zxbzml/list")
    @ApiOperation("兵团重点行业涉及的主要执行标准文件目录")
    public ResultState zxbzmlList(@RequestParam(name = "keyWord") String keyWord) {
        List<BuZxbzml> list = yqsthjService.zxbzmlList(keyWord);
        return list != null ? new ResultState(StateInfo.FIND_OK.getCode(),
                StateInfo.FIND_OK.getMsg(), list) : new ResultState(StateInfo.FIND_NULL.getCode(),
                StateInfo.FIND_NULL.getMsg());
    }

}
